Java Architecture & Features

BTech 4th Semester - UPES

Lecture 2: JDK vs JRE vs JVM & Java Programming Features

Instructor: Mohsin Dar

Today's Session:
• Understanding Java Architecture
• JDK vs JRE vs JVM
• Key Features of Java
• Real-world Applications

Java Architecture Overview

Understanding the Complete Java Ecosystem

🏗️ What is Java Architecture?

Java architecture consists of three main components that work together to enable the "Write Once, Run Anywhere" capability of Java:

  • JDK (Java Development Kit) - Development tools
  • JRE (Java Runtime Environment) - Runtime environment
  • JVM (Java Virtual Machine) - Virtual machine
Java Code (.java)
JDK Compiler
Bytecode (.class)
Bytecode (.class)
JVM
Machine Code
Key Concept: Java source code is compiled into bytecode, which is then interpreted or compiled by the JVM into native machine code for the specific platform.

JDK vs JRE vs JVM

Understanding the Differences and Relationships

Component Purpose Components Usage
JDK
(Java Development Kit)
Development JRE + Development Tools
(javac, jar, debugger, etc.)
For developers to create Java applications
JRE
(Java Runtime Environment)
Execution JVM + Library Classes
(Java API, rt.jar, etc.)
For users to run Java applications
JVM
(Java Virtual Machine)
Execution Engine Interpreter, JIT Compiler,
Garbage Collector
Executes bytecode on specific platform
JVM Architecture
Relationship: JDK ⊃ JRE ⊃ JVM
JDK contains JRE, and JRE contains JVM. You need JDK to develop, JRE to run, and JVM to execute.

Java Development Kit (JDK)

The Complete Development Environment

🛠️ What is JDK?

The JDK is a software development environment used for developing Java applications. It includes the JRE plus development tools.

Key Components:

  • javac - Java compiler
  • java - Java launcher
  • jar - Archive tool
  • javadoc - Documentation generator
  • jdb - Debugger
  • javap - Disassembler

📦 JDK Structure

JDK
├── JRE
│ ├── JVM
│ └── Java API
└── Development Tools
├── javac
├── jar
├── javadoc
└── jdb

Development Process:

  1. Write Java source code (.java)
  2. Compile using javac
  3. Create bytecode (.class)
  4. Package using jar
  5. Document using javadoc

Java Runtime Environment (JRE)

The Runtime Environment for Java Applications

⚙️ What is JRE?

The JRE provides the minimum requirements for executing a Java application. It contains the JVM and core Java libraries.

Key Components:

  • JVM - Virtual machine
  • Core Classes - Essential Java classes
  • Support Libraries - Additional functionality
  • Runtime Files - Configuration and resources

🎯 JRE Purpose

Provides a runtime environment without development tools. Perfect for end-users who only need to run Java applications.

When to Use JRE:

  • Deploying applications to servers
  • Distributing desktop applications
  • Running Java applets (historically)
  • Embedded systems
Note: Modern Java distributions often bundle JDK and JRE together for simplicity.

Java Virtual Machine (JVM)

The Heart of Java's Platform Independence

🤖 What is JVM?

The JVM is an abstract computing machine that enables Java bytecode to be executed on any platform, providing platform independence.

🔧 JVM Components

  • Class Loader - Loads class files
  • Bytecode Verifier - Verifies code safety
  • Execution Engine - Executes bytecode
  • Garbage Collector - Manages memory
  • Runtime Data Areas - Memory management

⚡ Execution Process

  1. Loading - Class files loaded into memory
  2. Linking - Verification and preparation
  3. Initialization - Static initializers executed
  4. Execution - Bytecode interpreted or compiled
JVM Internal Architecture

Features of Java Programming

What Makes Java Special?

Features of Java
Java's Success Factors: Platform independence, object-oriented design, robust security, automatic memory management, rich standard library, and strong community support have made Java one of the most popular programming languages worldwide.

Core Java Features

Fundamental Characteristics of Java

🌐 Platform Independence

Write Once, Run Anywhere (WORA). Java bytecode can run on any platform with JVM.

🎯 Object-Oriented

Everything is an object (except primitives). Supports all OOP principles.

🔒 Simple & Secure

No pointers, automatic memory management, bytecode verification, security manager.

💪 Robust

Strong memory management, exception handling, garbage collection, type checking.

🏗️ Architecture Neutral

Bytecode is not dependent on any architecture. Same code runs everywhere.

🚀 High Performance

JIT compiler converts bytecode to machine code for faster execution.

🔄 Multithreaded

Built-in support for concurrent execution of multiple threads.

📦 Rich Standard Library

Comprehensive APIs for data structures, networking, I/O, database, etc.

Platform Independence - WORA

Write Once, Run Anywhere

🔄 How Java Achieves Platform Independence

Java Source Code (.java)

Java Compiler (javac)

Bytecode (.class)

JVM (Platform Specific)

Machine Code

💻 Traditional Approach

Platform-specific compilation:

  • Windows → .exe
  • Linux → .out
  • Mac → .app
  • Need to recompile for each platform

☕ Java Approach

Platform-independent bytecode:

  • Compile once to .class
  • Run on any platform with JVM
  • Same bytecode everywhere
  • JVM handles platform differences

Java in the Real World

Applications and Impact

📱 Mobile Development

Android apps (Kotlin/Java), enterprise mobile solutions

🏢 Enterprise Applications

Banking systems, e-commerce, ERP, CRM solutions

🌐 Web Applications

Spring framework, microservices, REST APIs

📊 Big Data

Hadoop, Spark, Kafka, Elasticsearch

☁️ Cloud Computing

AWS services, cloud-native applications

🤖 IoT & Embedded

Smart devices, industrial automation

Java's Enduring Success: With over 25 years of evolution, Java continues to power critical infrastructure worldwide, from financial systems to space exploration, demonstrating its reliability, scalability, and adaptability.

Summary & Key Takeaways

What We Learned Today

🏗️ Java Architecture

JDK ⊃ JRE ⊃ JVM - Each serves specific purposes in development and execution

🔧 Development Tools

JDK provides complete development environment with compiler, debugger, and tools

⚙️ Runtime Environment

JRE provides everything needed to run Java applications without development tools

🤖 Virtual Machine

JVM enables platform independence through bytecode interpretation and compilation

Key Features Remember: Platform Independence, Object-Oriented, Secure, Robust, High Performance, Multithreaded, and Rich Standard Library make Java a versatile and powerful programming language for modern software development.

Questions?

Next Lecture: Java Syntax & Basic Programming Concepts

1 / 11